#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.device.feign.entity;


import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @version: 1.00.00
 * @description: 设备基本信息DTO
 * @copyright: Copyright (c) 2018 立林科技 All Rights Reserved
 * @company: 厦门立林科技有限公司
 * @author: wushoujiang
 * @date: 2021-01-13 15:14
 */
@Data
@NoArgsConstructor
public class DeviceBaseDTO {
    /**
     * 设备directDid
     */
    private String directDid;
    /**
     * 设备Did
     */
    private String did;
    /**
     * 设备服务类型
     */
    private Integer siid;

    /**
     * 服务类型
     */
    private Integer serviceType;

    /**
     * 楼层名称
     */
    private String floorName;
    /**
     * 房间名称
     */
    private String roomName;

    /**
     * 楼层id
     */
    private Long floorId;
    /**
     * 房间id
     */
    private Long roomId;

    public DeviceBaseDTO(String did, String directDid) {
        this.did = did;
        this.directDid = directDid;
    }

    public DeviceBaseDTO(String directDid, String did, Integer siid) {
        this.directDid = directDid;
        this.did = did;
        this.siid = siid;
    }

    public DeviceBaseDTO(String directDid, String did, Integer siid, Integer serviceType) {
        this(directDid, did, siid);
        this.serviceType = serviceType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DeviceBaseDTO that = (DeviceBaseDTO) o;
        if (Objects.nonNull(siid)) {
            if (directDid.equals(that.directDid)
                    && did.equals(that.did)
                    && siid.equals(that.siid) && (Objects.isNull(serviceType) || Objects.isNull(that.serviceType))) {
                return true;
            }
            if (directDid.equals(that.directDid)
                    && did.equals(that.did)
                    && siid.equals(that.siid) && Objects.equals(serviceType, that.serviceType)) {
                return true;
            }
            return false;
        }
        return directDid.equals(that.directDid)
                && did.equals(that.did)
                && Objects.isNull(siid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(directDid, did);
    }
}


